from django.db import models

# Create your models here.
class MdSpace(models.Model):
  id = models.AutoField(primary_key=True)
  type = models.CharField(max_length=30, null=False)
  space = models.CharField(max_length=50, null=False)
  upload_dir = models.CharField(max_length=300, null=False)
  description = models.CharField(max_length=50, null=False)

  def __str__(self):
    return "upload_dir:{}".format(self.upload_dir)

class MdFiles(models.Model):
  id = models.AutoField(primary_key=True)
  doc_type = models.CharField(max_length=50, null=False)
  space = models.CharField(max_length=50, null=False)
  upload_dir = models.CharField(max_length=300, null=False)
  upload_name = models.CharField(max_length=200, unique=True, null=False)
  cn_name = models.CharField(max_length=200, null=False, verbose_name="cn_name")
  text_content = models.TextField(max_length=10240, null=False)
  cur_editor = models.CharField(max_length=100, null=False)
  last_time = models.DateTimeField(auto_now=True)

  def __str__(self):
    return "UploadFileName:{}".format(self.cn_name)


